<template>
  <div class="report-list">
    <div class="line"></div>
    <transition-group name="list" tag="div" class="list">
      <div class="list-item" :key="item.timestamp" v-for="item in list">
        <div class="label" :style="{background: getBgColor(item.color)}"></div>
        <div class="text" :style="{color: getColor(item.color)}">{{item.content}}</div>
      </div>
    </transition-group>
  </div>
</template>

<script>
import config from 'assets/config'

const colors = config.levelColors

export default {
  name: 'report-list',
  props: ['list'],
  methods: {
    getColor(color){
      return colors[color]
    },
    getBgColor(color){
      return `linear-gradient(-145deg, transparent 0.38vh, ${colors[color]} 0) top right`
    }
  }
}
</script>

<style scoped>
.line{
  width: 0.37vh;
  height: 16.5vh;
  position: absolute;
  background-color: #1eaaf1;
}
.list{
  position: absolute;
  left: 1.11vh;
  right: 0;
  top: 0;
  bottom: 0;
  overflow: hidden;
  font-size: 1vh;
}
.list-enter{
  opacity: 0;
}
.list-item{
  transition: all 1s ease;
}
.list-item>.label{
  width: 2.96vh;
  height: 1.4vh;
  margin-bottom: .4vh;
}
.list-item>.text{
  line-height: 1.5vh;
  height: 3vh;
  overflow: hidden;
  margin-bottom: 1vh;
}
</style>
